import Vue from 'vue'
import VueRouter from 'vue-router'


import Home from '@/views/home/Home'
import Movies from '@/views/home/movies/Movies'
import InTheaters from '@/views/home/movies/InTheaters'
import ComingSoon from '@/views/home/movies/ComingSoon'

import Profile from '@/views/home/profile/Profile'
import Theaters from '@/views/home/theaters/Theaters'
import CityPicker from '@/views/city-picker/CityPicker'


Vue.use(VueRouter)
const routes = [{
        path: '/',
        redirect: '/home'
    }, {
        path: '/home',
        name: 'home',
        component: Home,
        redirect: '/home/movies',
        children: [{
                path: 'movies',
                name: 'movies',
                component: Movies,
                redirect: '/home/movies/intheaters',
                children: [{
                        path: 'intheaters',
                        name: 'intheaters',
                        meta: {
                            // 自己定义的标签可  可以从路由里得到
                            index: 1
                        },
                        component: InTheaters
                    },
                    { path: 'comingsoon', name: 'comingsoon', component: ComingSoon },
                ]
            },
            { path: 'theaters', name: 'theaters', component: Theaters },
            { path: 'profile', name: 'profile', component: Profile },
        ]
    },
    {
        path: '/citypicker',
        name: 'citypicker',
        meta: {
            // 自己定义的标签可  可以从路由里得到
            index: 2
        },
        component: CityPicker
    }

]
const router = new VueRouter({
    mode: 'history',
    routes
})
console.log(router);
export default router